package com.ruoyi.vstac.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.vstac.mapper.CategoryMapper;
import com.ruoyi.vstac.domain.Category;
import com.ruoyi.vstac.service.ICategoryService;

import javax.annotation.Resource;

/**
 * 参赛组别Service业务层处理
 * 
 * @author kingner
 * @date 2024-07-08
 */
@Service
public class CategoryServiceImpl implements ICategoryService 
{
    @Resource
    private CategoryMapper categoryMapper;

    /**
     * 查询参赛组别
     * 
     * @param categoryId 参赛组别主键
     * @return 参赛组别
     */
    @Override
    public Category selectCategoryByCategoryId(int categoryId)
    {
        return categoryMapper.selectCategoryByCategoryId(categoryId);
    }
    public Category selectCategoryByUserId(Long userId) {
        return categoryMapper.selectCategoryByUserId(userId);
    }

    /**
     * 查询参赛组别列表
     * 
     * @param category 参赛组别
     * @return 参赛组别
     */
    @Override
    public List<Category> selectCategoryList(Category category)
    {
        return categoryMapper.selectCategoryList(category);
    }

    /**
     * 新增参赛组别
     * 
     * @param category 参赛组别
     * @return 结果
     */
    @Override
    public int insertCategory(Category category)
    {
        category.setCreateTime(DateUtils.getNowDate());
        return categoryMapper.insertCategory(category);
    }

    /**
     * 修改参赛组别
     * 
     * @param category 参赛组别
     * @return 结果
     */
    @Override
    public int updateCategory(Category category)
    {
        category.setUpdateTime(DateUtils.getNowDate());
        return categoryMapper.updateCategory(category);
    }

    /**
     * 批量删除参赛组别
     * 
     * @param categoryIds 需要删除的参赛组别主键
     * @return 结果
     */
    @Override
    public int deleteCategoryByCategoryIds(int[] categoryIds)
    {
        return categoryMapper.deleteCategoryByCategoryIds(categoryIds);
    }

    /**
     * 删除参赛组别信息
     * 
     * @param categoryId 参赛组别主键
     * @return 结果
     */
    @Override
    public int deleteCategoryByCategoryId(int categoryId)
    {
        return categoryMapper.deleteCategoryByCategoryId(categoryId);
    }
}
